import { createSlice } from '@reduxjs/toolkit'

const persons = createSlice({
	name: 'persons',
	initialState: {
		value: [{ id: '001', name: 'Tom', age: 18 }],
	},
	reducers: {
		addPerson: (state, action) => {
			state.value = [action.payload, ...state.value]
		},
	},
})
export const { addPerson } = persons.actions
export default persons.reducer
